
// Copyright (C) 2007 Richard Uhler
// This file is part of Esiply.
//
// Esiply is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License, Version 2,
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#ifndef _UNARY_EXPRESSION_H_
#define _UNARY_EXPRESSION_H_

// This is a class for general unary expressions with the form
// that you have a single Expression which you operate on.

#include "Expression.h"

class Scope;
class UnaryExpression;

typedef Value*(UnaryExpression::*unary_operation_t)(Scope* scope) const;

class UnaryExpression : public Expression
{
public:
    UnaryExpression(unary_operation_t op, Expression* exp);
    virtual Value* evaluate(Scope* scope);

    //  Here are all the unary operations.
    Value* bitwise_not(Scope* scope) const;
    Value* delete_op(Scope* scope) const;
    Value* identifier(Scope* scope) const;
    Value* minus(Scope* scope) const;
    Value* logical_not(Scope* scope) const;
    Value* post_decrement(Scope* scope) const;
    Value* post_increment(Scope* scope) const;
    Value* plus(Scope* scope) const;
    Value* pre_decrement(Scope* scope) const;
    Value* pre_increment(Scope* scope) const;
    Value* typeof_op(Scope* scope) const;
    Value* void_op(Scope* scope) const;

private:
    unary_operation_t m_op;
    Expression* m_exp;
};

#endif//_UNARY_EXPRESSION_H_

